package com.audaque.springboot.foshanupload.web.util;

import java.util.Collection;
import javax.servlet.http.HttpServletResponse;

public class HttpResponseUtils {
    public HttpResponseUtils() {
    }

    public static void writeHeader(HttpServletResponse response, String header, String value) {
        Collection<String> aceh = response.getHeaders("Access-Control-Expose-Headers");
        if (aceh == null) {
            response.setHeader("Access-Control-Expose-Headers", header);
        } else if (!aceh.contains(header)) {
            response.addHeader("Access-Control-Expose-Headers", header);
        }

        response.addHeader(header, value);
    }
}
